home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / Balloons.h < prev    next >
Text File  |  1991-05-01  |  10KB  |  226 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 27, 1991 at 8:21 PM
  4.     Balloons.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc. 1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __BALLOONS__
  15. #define __BALLOONS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __GEOMETRY__
  22. #include <Geometry.h>
  23. #endif
  24.  
  25. #ifndef __QUICKDRAW__
  26. #include <Quickdraw.h>
  27. #endif
  28.  
  29. #ifndef __MENUS__
  30. #include <Menus.h>
  31. #endif
  32.  
  33. #ifndef __TRAPS__
  34. #include <Traps.h>
  35. #endif
  36.  
  37.  
  38. enum {
  39.  
  40.     hmBalloonHelpVersion = 0x0002,      /* The real version of the Help Manager */
  41.  
  42. /*Help Mgr error range: -850 to -874*/
  43.     hmHelpDisabled = -850,              /* Show Balloons mode was off, call to routine ignored */
  44.     hmBalloonAborted = -853,            /* Returned if mouse was moving or mouse wasn't in window port rect */
  45.     hmSameAsLastBalloon = -854,         /* Returned from HMShowMenuBalloon if menu & item is same as last time */
  46.     hmHelpManagerNotInited = -855,      /* Returned from HMGetHelpMenuHandle if help menu not setup */
  47.     hmSkippedBalloon = -857,            /* Returned from calls if helpmsg specified a skip balloon */
  48.     hmWrongVersion = -858,              /* Returned if help mgr resource was the wrong version */
  49.     hmUnknownHelpType = -859,           /* Returned if help msg record contained a bad type */
  50.     hmOperationUnsupported = -861,      /* Returned from HMShowBalloon call if bad method passed to routine */
  51.     hmNoBalloonUp = -862,               /* Returned from HMRemoveBalloon if no balloon was visible when call was made */
  52.     hmCloseViewActive = -863,           /* Returned from HMRemoveBalloon if CloseView was active */
  53.     kHMHelpMenuID = -16490,             /* Resource ID and menu ID of help menu */
  54.     kHMAboutHelpItem = 1,               /* help menu item number of About Balloon Help… */
  55.     kHMShowBalloonsItem = 3,            /* help menu item number of Show/Hide Balloons */
  56.     kHMHelpID = -5696,                  /* ID of various Help Mgr package resources (in Pack14 range) */
  57.     kBalloonWDEFID = 126,               /* Resource ID of the WDEF proc used in standard balloons */
  58.  
  59. /*Dialog item template type*/
  60.     helpItem = 1,                       /* key value in DITL template that corresponds to the help item */
  61.  
  62. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  63.     hmDefaultOptions = 0,               /* default options for help manager resources */
  64.     hmUseSubID = 1,                     /* treat resID's in resources as subID's of driver base ID */
  65.     hmAbsoluteCoords = 2                /* ignore window port origin and treat rectangles as absolute coords */
  66. };
  67. enum {
  68.     hmSaveBitsNoWindow = 4,             /* don't create a window, just blast bits on screen. No update event is generated */
  69.     hmSaveBitsWindow = 8,               /* create a window, but restore bits behind window when window goes away */
  70.     hmMatchInTitle = 16,                /* for hwin resources, match string anywhere in window title string */
  71.  
  72. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  73.     kHMStringItem = 1,                  /* pstring used in resource */
  74.     kHMPictItem = 2,                    /* 'PICT' ResID used in resource */
  75.     kHMStringResItem = 3,               /* 'STR#' ResID & index used in resource */
  76.     kHMTEResItem = 6,                   /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  77.     kHMSTRResItem = 7,                  /* 'STR ' ResID used in resource */
  78.     kHMSkipItem = 256,                  /* don't display a balloon */
  79.     kHMCompareItem = 512,               /* Compare pstring in menu item w/ PString in resource item */
  80.     kHMNamedResourceItem = 1024,        /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  81.     kHMTrackCntlItem = 2048,            /* Reserved */
  82.  
  83. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  84.     khmmString = 1,                     /* help message contains a PString */
  85.     khmmPict = 2,                       /* help message contains a resource ID to a 'PICT' resource */
  86.     khmmStringRes = 3,                  /* help message contains a res ID & index to a 'STR#' resource */
  87.     khmmTEHandle = 4,                   /* help message contains a Text Edit handle */
  88.     khmmPictHandle = 5,                 /* help message contains a Picture handle */
  89.     khmmTERes = 6,                      /* help message contains a res ID to 'TEXT' & 'styl' resources */
  90.     khmmSTRRes = 7,                     /* help message contains a res ID to a 'STR ' resource */
  91.  
  92. #define kHMTETextResType 'TEXT'         /* Resource Type of text data for styled TE record w/o style info */
  93. #define kHMTEStyleResType 'styl'        /* Resource Type of style information for styled TE record */
  94.  
  95. /*Generic defines for the switch items used in 'hmnu' & 'hdlg'*/
  96.  
  97.     kHMEnabledItem = 0                  /* item is enabled, but not checked or control value = 0 */
  98. };
  99. enum {
  100.     kHMDisabledItem = 1,                /* item is disabled, grayed in menus or disabled in dialogs */
  101.     kHMCheckedItem = 2,                 /* item is enabled, and checked or control value = 1 */
  102.     kHMOtherItem = 3,                   /* item is enabled, and control value > 1 */
  103.  
  104. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  105.  
  106. #define kHMMenuResType 'hmnu'           /* ResType of help resource for supporting menus */
  107. #define kHMDialogResType 'hdlg'         /* ResType of help resource for supporting dialogs */
  108. #define kHMWindListResType 'hwin'       /* ResType of help resource for supporting windows */
  109. #define kHMRectListResType 'hrct'       /* ResType of help resource for rectangles in windows */
  110. #define kHMOverrideResType 'hovr'       /* ResType of help resource for overriding system balloons */
  111. #define kHMFinderApplResType 'hfdr'     /* ResType of help resource for custom balloon in Finder */
  112.  
  113. /* constants to pass to method parameter in HMShowBalloon */
  114.  
  115.     kHMRegularWindow = 0,               /* Create a regular window floating above all windows */
  116.     kHMSaveBitsNoWindow = 1,            /* Just save the bits and draw (for MDEF calls) */
  117.     kHMSaveBitsWindow = 2               /* Regular window, save bits behind, AND generate update event */
  118. };
  119.  
  120. struct HMStringResType {
  121.     short hmmResID;
  122.     short hmmIndex;
  123. };
  124.  
  125. typedef struct HMStringResType HMStringResType;
  126.  
  127. struct HMMessageRecord {
  128.         short        hmmHelpType;
  129.         union {
  130.                     char                hmmString[256];
  131.                     short                hmmPict;
  132.                     Handle                hmmTEHandle;
  133.                     HMStringResType        hmmStringRes;
  134.                     short                hmmPictRes;
  135.                     Handle                hmmPictHandle;
  136.                     short                hmmTERes;
  137.                     short                hmmSTRRes;
  138.                 } u;
  139. };
  140.  
  141. typedef struct HMMessageRecord HMMessageRecord;
  142. typedef HMMessageRecord *HMMessageRecPtr;
  143.  
  144.  
  145. #ifdef __cplusplus
  146. extern "C" {
  147. #endif
  148. /*  Public Interfaces  */
  149. pascal OSErr HMGetHelpMenuHandle(MenuHandle& mh)
  150.     = {0x303C,0x0200,_Pack14}; 
  151. pascal OSErr HMShowBalloon(const HMMessageRecord& aHelpMsg,
  152.                            Point tip,
  153.                            RectPtr alternateRect,
  154.                            Ptr tipProc,
  155.                            short theProc,
  156.                            short variant,
  157.                            short method)
  158.     = {0x303C,0x0B01,_Pack14}; 
  159. pascal OSErr HMRemoveBalloon(void)
  160.     = {0x303C,0x0002,_Pack14}; 
  161. pascal Boolean HMGetBalloons(void)
  162.     = {0x303C,0x0003,_Pack14}; 
  163. pascal OSErr HMSetBalloons(Boolean flag)
  164.     = {0x303C,0x0104,_Pack14}; 
  165. pascal OSErr HMShowMenuBalloon(short itemNum,
  166.                                short itemMenuID,
  167.                                long itemFlags,
  168.                                long itemReserved,
  169.                                Point tip,
  170.                                RectPtr alternateRect,
  171.                                Ptr tipProc,
  172.                                short theProc,
  173.                                short variant)
  174.     = {0x303C,0x0E05,_Pack14}; 
  175. pascal OSErr HMGetIndHelpMsg(ResType whichType,
  176.                              short whichResID,
  177.                              short whichMsg,
  178.                              short whichState,
  179.                              long& options,
  180.                              Point& tip,
  181.                              Rect& altRect,
  182.                              short& theProc,
  183.                              short& variant,
  184.                              HMMessageRecord& aHelpMsg,
  185.                              short& count)
  186.     = {0x303C,0x1306,_Pack14}; 
  187. pascal Boolean HMIsBalloon(void)
  188.     = {0x303C,0x0007,_Pack14}; 
  189. pascal OSErr HMSetFont(short font)
  190.     = {0x303C,0x0108,_Pack14}; 
  191. pascal OSErr HMSetFontSize(short fontSize)
  192.     = {0x303C,0x0109,_Pack14}; 
  193. pascal OSErr HMGetFont(short& font)
  194.     = {0x303C,0x020A,_Pack14}; 
  195. pascal OSErr HMGetFontSize(short& fontSize)
  196.     = {0x303C,0x020B,_Pack14}; 
  197. pascal OSErr HMSetDialogResID(short resID)
  198.     = {0x303C,0x010C,_Pack14}; 
  199. pascal OSErr HMSetMenuResID(short menuID,
  200.                             short resID)
  201.     = {0x303C,0x020D,_Pack14}; 
  202. pascal OSErr HMBalloonRect(const HMMessageRecord& aHelpMsg,
  203.                            Rect& coolRect)
  204.     = {0x303C,0x040E,_Pack14}; 
  205. pascal OSErr HMBalloonPict(const HMMessageRecord& aHelpMsg,
  206.                            PicHandle& coolPict)
  207.     = {0x303C,0x040F,_Pack14}; 
  208. pascal OSErr HMScanTemplateItems(short whichID,
  209.                                  short whichResFile,
  210.                                  ResType whichType)
  211.     = {0x303C,0x0410,_Pack14}; 
  212. pascal OSErr HMExtractHelpMsg(ResType whichType,short whichResID,short whichMsg,
  213.     short whichState,HMMessageRecord& aHelpMsg)
  214.     = {0x303C,0x0711,_Pack14}; 
  215. pascal OSErr HMGetDialogResID(short& resID)
  216.     = {0x303C,0x0213,_Pack14}; 
  217. pascal OSErr HMGetMenuResID(short menuID,short& resID)
  218.     = {0x303C,0x0314,_Pack14}; 
  219. pascal OSErr HMGetBalloonWindow(WindowPtr& window)
  220.     = {0x303C,0x0215,_Pack14}; 
  221. #ifdef __cplusplus
  222. }
  223. #endif
  224.  
  225. #endif
  226.